package com.web.customers;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.service.CustomerService;
import com.util.AuthenticateHttpServlet;

@WebServlet("/Customer/Delete")
public class CustomerDeleteController extends AuthenticateHttpServlet{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	protected void post(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
			CustomerService model = new CustomerService();
			String customer_id = req.getParameter("CUSTOMER_ID");
			boolean result = model.deleteCustomer(customer_id);
			if (result) {
				req.getRequestDispatcher("../Customer/List").forward(req, resp);
			}else{
				
				req.getRequestDispatcher("/WEB-INF/jsp/CustomerDeleteFailed.jsp").forward(req, resp);
			} 
				
		}
	}



